<!--# include virtual="/lib/table-base.js" -->
// form switch
form.on('switch(index-swith)', function(data){
  var el  = data.elem;
  var $el = $(el);
  var fl  = $el.data('field') || 'status';
  var ff  = $el.data('value') || '';
  if(ff){
    ff = ff.split('|');
    var v1 = el.checked ? ff[0] : ff[1];
  }else{
    var vl = $el.hasClass('js-reverse') ? (el.checked ? 0:1) : (el.checked ? 1:0);
  }
  // console.log('todo :',el);
  // console.log(fl,vl);
  // return false;
  // rb.post(el,layui.cache.apiPath + rb.controller + "/editOne",{ field: fl,val: vl,id:parseInt(el.getAttribute('data-id')),sid:rb.local("uinfo").sid },true);

  $.post(layui.cache.apiPath + rb.controller + "/editOne",{ field: fl,val: vl,id:parseInt(el.getAttribute('data-id')),sid:rb.local("uinfo").sid },function(d){
    rb.ajaxTip(d,false,function(dat){
      // console.log('err',data);
      data.othis.prev('input').prop('checked',false);
      form.render('checkbox');
    });
  });
});
// table column edit
table.on('edit(index-table)', function(obj){
  // console.log(obj); // value , field ,data
  $.post(layui.cache.apiPath + rb.controller + "/editOne", { field: obj.field,val: obj.value,id:obj.data.id,sid:rb.local("uinfo").sid }, function(data){
    rb.ajaxTip(data);
  });
});